//
//  FinishOrderDetailTimeTableViewCell.m
//  rrqs
//
//  Created by mac book on 2019/5/7.
//

#import "FinishOrderDetailTimeTableViewCell.h"

@interface FinishOrderDetailTimeTableViewCell ()



@property(nonatomic,strong) UILabel* xiadanLabel;
@property(nonatomic,strong) UILabel* quhuoLabel;
@property(nonatomic,strong) UILabel* wanchengLabel;


@end


@implementation FinishOrderDetailTimeTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self =  [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        
        [self createSubviews];
        
    }
    return self;
}

#pragma mark - createSubviews
-(void)createSubviews{
    
    
    [self.contentView addSubview:self.xiadanLabel];
    [self.contentView addSubview:self.wanchengLabel];
    [self.contentView addSubview:self.quhuoLabel];
    

    NSArray *masonryViewArray = @[self.xiadanLabel,self.quhuoLabel,self.wanchengLabel];
    
    [masonryViewArray mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedSpacing:1 leadSpacing:0 tailSpacing:0];
    
    // 设置array的垂直方向的约束
    [masonryViewArray mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.bottom.equalTo(self.contentView).offset(0);
        make.height.mas_equalTo(40);
        
    }];
    
    
    UIView *line1 = [[UIView alloc] init];
    line1.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self.contentView addSubview:line1];
    [line1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.xiadanLabel.mas_right);
        make.top.equalTo(self.contentView).offset(5);
        make.bottom.equalTo(self.contentView).offset(-5);
        make.width.mas_equalTo(0.8);
        
    }];
    
    
    UIView *line2 = [[UIView alloc] init];
    line2.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self.contentView addSubview:line2];
    [line2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.quhuoLabel.mas_right);
        make.top.equalTo(self.contentView).offset(5);
        make.bottom.equalTo(self.contentView).offset(-5);
        make.width.mas_equalTo(0.8);
        
    }];
    
    
    
    
}

-(void)setEntity:(MOrder *)entity{
    
    
    _entity = entity;
    
    self.xiadanLabel.text = [NSString stringWithFormat:@"%@\n下单时间",entity.add_time];
    self.quhuoLabel.text = [NSString stringWithFormat:@"%@\n取货时间",entity.jiedan_time];
    self.wanchengLabel.text = [NSString stringWithFormat:@"%@\n完成时间",entity.wancheng_time];
    
    
}

-(UILabel *)xiadanLabel{
    if(!_xiadanLabel){
        _xiadanLabel = [[UILabel alloc]init];
        _xiadanLabel.textColor =kMyColor(130, 130, 130);
        _xiadanLabel.font = kFontNameSize(12);
        _xiadanLabel.numberOfLines = 2;
        _xiadanLabel.lineBreakMode = NSLineBreakByCharWrapping;
        _xiadanLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _xiadanLabel;
}


-(UILabel *)quhuoLabel{
    if(!_quhuoLabel){
        _quhuoLabel = [[UILabel alloc]init];
        _quhuoLabel.textColor =kMyColor(130, 130, 130);
        _quhuoLabel.font = kFontNameSize(12);
        _quhuoLabel.numberOfLines = 2;
        _quhuoLabel.lineBreakMode = NSLineBreakByCharWrapping;
        _quhuoLabel.textAlignment = NSTextAlignmentCenter;

    }
    return _quhuoLabel;
}

-(UILabel *)wanchengLabel{
    if(!_wanchengLabel){
        _wanchengLabel = [[UILabel alloc]init];
        _wanchengLabel.textColor =kMyColor(130, 130, 130);
        _wanchengLabel.font = kFontNameSize(12);
        _wanchengLabel.numberOfLines = 2;
        _wanchengLabel.lineBreakMode = NSLineBreakByCharWrapping;
        _wanchengLabel.textAlignment = NSTextAlignmentCenter;

    }
    return _wanchengLabel;
}





- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
